<template>
	<div>
		<div>
			<span><i class="el-icon-search el-icon--right"></i> 筛选查询</span>
			&nbsp;&nbsp;
			登记时间:
			<el-date-picker v-model="startime" type="date" placeholder="选择日期" value-format="yyyy-MM-dd">
			</el-date-picker>&nbsp;到
			<el-date-picker v-model="endtime" type="date" placeholder="选择日期" value-format="yyyy-MM-dd">
			</el-date-picker>
			&nbsp;&nbsp;
			项目:
			<el-select v-model="projectname" placeholder="请选择" clearable>
				<el-option v-for="item in project" :key="item.logId" :label="item.projectName"
					:value="item.projectName">
				</el-option>
			</el-select>
			&nbsp;&nbsp;
			<el-button @click="Findit" style="margin-left: 200px;">查询<i class="el-icon-search el-icon--right"></i>
			</el-button>
		</div>


	<el-table :data="pageInfo.records" style="width: 100%">
		<el-table-column prop="projectName" label="项目名称">
		</el-table-column>
		<el-table-column prop="createBy" label="登记人">
		</el-table-column>
		<el-table-column prop="logDate" label="登记时间">
		</el-table-column>
		<el-table-column prop="workHours" label="登记工时(小时)">
		</el-table-column>
	</el-table>
	
	<div id="DS-Bottom">
		<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
			:current-page="pageInfo.current" :page-sizes="[1, 2, 3, 4]" :page-size="pageInfo.size"
			layout="total, sizes, prev, pager, next, jumper" :total="pageInfo.total">
		</el-pagination>
	</div>
	</div>
</template>

<script>
	export default {
		name: "dayworktime",
		data() {
			return {
				current: 1,
				size: 3,
				pageInfo: {},
				projectname:"",
				project:[],
				startime:"",
				endtime:""
				
			}
		},
		methods: {
			handleSizeChange(val) {
				this.size = val;
				this.GetDefectList(this.current, val, this.startime, this.endtime, this.projectname);
			
			},
			handleCurrentChange(val) {
				this.current = val;
				this.GetDefectList(val, this.size, this.startime, this.endtime, this.projectname);
			},
			Findit(){
				this.GetAllProject(this.current, this.size,this.startime,this.endtime,this.projectname);
			},
			GetInfo() {
				this.$http.get("/worktimeLog/GetProject").then(resp => {
					this.project=resp.data.data
				})
			},
			GetAllProject(current, size,startime,endtime,projectname) {
				this.$http.post("/worktimeLog/GetAllProject", {
					current: current,
					size: size,
					startime:startime,
					endtime:endtime,
					projectname:projectname
				}).then(resp => {
					console.log(resp.data.data)
					this.pageInfo = resp.data.data;
				});
			}
		},
		created() {
			this.GetAllProject(this.current, this.size,this.startime,this.endtime,this.projectname);
			this.GetInfo()
		}
	}
</script>

<style>
	#DS-Bottom {
		position: absolute;
		text-align: right;
		bottom: 0;
		height: 35px;
		left: 0;
		right: 0;
	}
</style>
